package cn.lili.modules.grab.dingdong;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.grab.GrabAdjunctParam;
import cn.lili.modules.grab.GrabNoticeParam;
import cn.lili.modules.grab.dingdong.base.BaseResult;
import cn.lili.modules.grab.dingdong.reps.adjunct.AreaRespose;
import cn.lili.modules.grab.dingdong.service.DingdongNoticeService;
import cn.lili.modules.grab.enums.SourceEnums;
import cn.lili.modules.grab.enums.StatusEnums;
import cn.lili.modules.grab.factory.notice.GrabNoticeService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Slf4j
public class GrabDingdongNoticeServiceImpl implements GrabNoticeService {

    @Resource
    private DingdongNoticeService dingdongNoticeService;

    @Override
    public SourceEnums step() {
        return SourceEnums.DINGDONG_NOTICE;
    }

    /**
     * 订单回调通知接口
     *
     * @param grabParam 参数
     */
    @Override
    public BaseResult orderCallback(GrabNoticeParam grabParam) {
        log.info("企叮当--地址查询入参----{}", JSONObject.toJSONString(grabParam));
        BaseResult baseResult = dingdongNoticeService.orderCallback(grabParam.getOrderCallbackRequest());
        //其它业务逻辑
        return baseResult;
    }

    /**
     * 商品信息修改通知
     *
     * @param grabParam 参数
     */
    @Override
    public BaseResult goodsCallback(GrabNoticeParam grabParam) {
        log.info("企叮当--地址查询入参----{}", JSONObject.toJSONString(grabParam));
        BaseResult baseResult = dingdongNoticeService.goodsCallback(grabParam.getGoodsCallbackRequest());
        return baseResult;
    }
}
